﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
 * WYMeditor : what you see is What You Mean web-based editor
 * Copyright (C) 2007 H.O.net - http://www.honet.be/
 * Dual licensed under the MIT (MIT-license.txt)
 * and GPL (GPL-license.txt) licenses.
 *
 * For further information visit:
 *        http://www.wymeditor.org/
 *
 * File Name:
 *        advanced.html
 *        Editor integration example.
 *        See the documentation for more info.
 *
 * File Authors:
 *        Jean-Francois Hovinne (jf.hovinne@wymeditor.org)
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>WYMeditor</title>
<link rel="stylesheet" type="text/css" media="screen" href="../wymeditor/skins/default/screen.css" />
<script type="text/javascript" src="../jquery/jquery.js"></script>
<script type="text/javascript" src="../wymeditor/lang/en.js"></script>
<script type="text/javascript" src="../wymeditor/jquery.wymeditor.js"></script>
<script type="text/javascript" src="../wymeditor/jquery.wymeditor.explorer.js"></script>
<script type="text/javascript" src="../wymeditor/jquery.wymeditor.mozilla.js"></script>
<script type="text/javascript" src="../wymeditor/jquery.wymeditor.opera.js"></script>
<script type="text/javascript" src="../wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js"></script>
<script type="text/javascript" src="../wymeditor/plugins/tidy/jquery.wymeditor.tidy.js"></script>

<script type="text/javascript">


var w;
jQuery(function() {
  
    jQuery('.wymeditor').wymeditor({
    
      xhtmlParser: 'xhtml_parser.js',
      cssParser:   'wym_css_parser.js',

      // External CSS file
      stylesheet: 'wym_stylesheet.css',
      
      //function called when WYMeditor instance is ready
      //wym is the WYMeditor instance
      fPostInit: function(wym) {
      
        //set the editor's HTML value
        wym.html("<p>WYMeditor <em>instance<\/em> "
        + wym._index
        + " with <strong>some text<\/strong>."
        + "<\/p>"
        + "<p><img alt='SourceForge Logo'"
        + " src='http://sflogo.sourceforge.net/sflogo.php"
        + "?group_id=148869&amp;type=1' \/><\/p>"
        + "<ul><li>One<\/li><li>Two<\/li><li>Three<\/li><\/ul>");
        
        //set the status bar value
        wym.status('&nbsp;');
        
        //activate 'tidy' plugin
        //which cleans up the HTML
        var wymtidy = wym.tidy();
        wymtidy.init();

        //activate 'hovertools' plugin
        //which gives more feedback to the user
        wym.hovertools();
        
        w = wym;
      },
      
      //function called when dialog is ready
      //wym is the WYMeditor instance
      //wdw is the dialog's window
      fPostInitDialog: function(wym,wdw) {

        var body = wdw.document.body;
        
        //add a select box populated with predefined values to the dialog
        
        var sSelectLink = "<div class='row row-indent'>"
        + "<select class='wym_select_link'>"
        + "<option selected value='WYMeditor http://www.wymeditor.org/'>"
        + "WYMeditor<\/option>"
        + "<option value='SourceForge http://www.sourceforge.net/'>"
        + "SourceForge<\/option>"
        + "<option value='GNU http://www.gnu.org/'>"
        + "GNU<\/option>"
        + "<\/select>"
        + "<input class='wym_choose' type='button'"
        + " value='{Choose}' />"
        + "<\/div>";
        
        jQuery(body)
          .filter('.wym_dialog_link').find('fieldset').eq(0)
          .prepend(wym.replaceStrings(sSelectLink));
          
        jQuery(body)
          .find('.wym_choose')
          .click(function() {

            var sVal = jQuery(body).find('.wym_select_link').val();
            
            jQuery(body)
              .find('.wym_href')
              .val(sVal.substring(sVal.lastIndexOf(' ') + 1));
            jQuery(body)
              .find('.wym_title')
              .val(sVal.substr(0, sVal.lastIndexOf(' ')));
          });
      }
    });
    
    jQuery('.wymupdate').click(function() {
      alert(jQuery(this).siblings('.wymeditor').val());
    });
});

</script>


</head>

<body>
<h1>WYMeditor external CSS integration example</h1>
<p><a href="http://www.wymeditor.org/">WYMeditor</a> is a web-based XHTML WYSIWYM editor.</p>
<form method="post" action="">
<textarea class="wymeditor"></textarea>
<input type="submit" class="wymupdate" />
</form>
<p>
<a href="http://sourceforge.net/projects/wym-editor">
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=148869&amp;type=1" border="0" alt="SourceForge logo" title="SourceForge" />
</a>
</p>

</body>

</html>
